#include "qled.h"
#include <QDebug>

QLed::QLed(QWidget *parent):QLabel(parent), color(Qt::white)
{
    setFixedSize(22,22);
    setColor(Qt::red);
    setStatus(true);
}

void QLed::paintEvent(QPaintEvent *)
{
    paint.begin(this);
    paint.setBrush(QBrush(color,Qt::SolidPattern));
    paint.drawEllipse(0, 0, 20, 20);
    paint.end();
}

void QLed::setColor(QColor c)
{
    color = c;
    this->update();
}

void QLed::setStatus(bool on)
{
    setVisible(on);
}
